# Contributor: Taner Tas <taner76@gmail.com>
# Maintainer: Taner Tas <taner76@gmail.com>
pkgname=spark
_pkgname=Spark
pkgver=2.8.3
pkgrel=0
pkgdesc="Cross-platform IM client optimized for businesses and organizations."
url="https://www.igniterealtime.org/projects/spark/"
arch="all !mips !mips64" # java
license="Apache-2.0"
depends="
	hicolor-icon-theme
	openjdk8-jre
	portaudio
	"
makedepends="apache-ant openjdk8"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/igniterealtime/$_pkgname/archive/v$pkgver.tar.gz
	spark.sh
	spark.desktop
	"
options="!check" # No test suite
builddir="$srcdir/$_pkgname-$pkgver"

build() {
	cd "$builddir"/build
	ant jar
}

package() {
	cd "$builddir"
	install -Dm0755 "$srcdir"/spark.sh "$pkgdir"/usr/bin/spark
	for i in 16x16 24x24 32x32 64x64; do install -Dm0644 \
		"$builddir"/src/resources/images/spark-$i.png \
		"$pkgdir"/usr/share/icons/hicolor/$i/apps/$pkgname.png
		done
	install -Dm0644 "$srcdir"/spark.desktop "$pkgdir"/usr/share/applications/spark.desktop
	for i in bin logs documentation linux linux64 windows windows64 mac; do
		rm -r target/build/$i || rm -rf target/build/lib/$i
	done
	cp -R target/build "$pkgdir"/usr/share/$pkgname
	rm -vf "$pkgdir"/usr/share/spark/resources/*.dll
}

sha512sums="0fc8fded8105a069a9791e950828ea91ea5fe147531c9dc418bb069f2b89dc2a1851e05a82b6c27b7fb9b8bdc1a2538579b299e314be1d2e505d2eea117175fd  spark-2.8.3.tar.gz
e3d0575d34fe881bd53eab99c54723097d8601075497891d7bf49bb68c009720e488fcf2323f92a264b23ea288c2d30b75112566d84a056e3aaa58b656189773  spark.sh
98f3e25850d11d77acae7e4e3fff8ad51302a84de9f5bbd65ba302a05649f803f3f89cfc65605ffe851d51a5f752e85a328a691cf777ee0fe667335980b11027  spark.desktop"
